﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _2.CountriesAndTownsLists
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private List<Country> countries;

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.countries = new List<Country>()
            {
                new Country() {Name = "Bulgaria", Language = "Bulgarian", Towns = new List<Town> {
                                                                         new Town("Montana", 10000),
                                                                         new Town("Sofia", 2000000),
                                                                         new Town("Varna", 100000)
                                                                     }, 
                                                                        Image = @"..\..\images\Bulgaria-flag.jpg"
                },                    
                new Country() {Name = "England", Language = "English", Towns = new List<Town> {
                                                                         new Town("London", 1000000),
                                                                         new Town("Manchester", 2000000),
                                                                         new Town("Liverpool", 500000),
                                                                         new Town("Birmingham", 250000)
                                                                     },
                                                                        Image = @"..\..\images\England_flag.png"
                },
                new Country() {Name = "Spain", Language = "Spanish", Towns =  new List<Town> {
                                                                         new Town("Madrid", 3000000),
                                                                         new Town("Barcelona", 2500000),
                                                                     },
                                                                        Image = @"..\..\images\spain-flag.gif"
                }
            };

            this.GridMain.DataContext = countries;
        }
    }
}
